/**************************************
* TABLE 1: SUMMARY STATISTICS ON STAFF
**************************************/

clear
use member_staff_rank1_salary.dta
* number of staff
by congress core_person_id, sort: gen tt = 1 if _n ==1 
tab congress if tt ==1
* female staff %
gen femalestaff = 0
replace femalestaff = 1 if gender =="F"
tab congress femalestaff, row
* annual salary
gen annusalary = salary/2
forvalues i = 107(1)113 {  
sum annusalary if congress ==`i'
}
*turnover 
keep congress core_person_id
duplicates drop
gen work = 1
reshape wide work, i(core_person_id) j(congress)
forvalues i = 107(1)113 {  
replace work`i' = 0 if work`i' ==.
}
gen turnover107 = .
replace turnover107 = 0 if work107 == 1 & work108 == 1
replace turnover107 = 1 if work107 == 1 & work108 == 0
gen turnover108 = .
replace turnover108 = 0 if work108 == 1 & work109 == 1
replace turnover108 = 1 if work108 == 1 & work109 == 0
gen turnover109 = .
replace turnover109 = 0 if work109 == 1 & work110 == 1
replace turnover109 = 1 if work109 == 1 & work110 == 0
gen turnover110 = .
replace turnover110 = 0 if work110 == 1 & work111 == 1
replace turnover110 = 1 if work110 == 1 & work111 == 0
gen turnover111 = .
replace turnover111 = 0 if work111 == 1 & work112 == 1
replace turnover111 = 1 if work111 == 1 & work112 == 0
gen turnover112 = .
replace turnover112 = 0 if work112 == 1 & work113 == 1
replace turnover112 = 1 if work112 == 1 & work113 == 0
forvalues i = 107(1)112 {  
sum turnover`i'
}



